from datetime import datetime
def dec(func):
    def real_connect(host,port):
        f = open("a.log","a")
        t = datetime.now()
        f.write("%s---%s:%s"%(t,host,port))
        f.close()
        func(host,port)
    return real_connect

@dec
def connect(host,port):
    print("%s:%s"%(host,port))

connect("192.168.1.1",'222')